﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YJKArch.RevitCommands
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdRevisionCloud : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			string text = ShortcutsFile.GetShortcuts(RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.RevisionCloud).Name, cmdData.Application.ActiveUIDocument.Document);
			if (text == null || text.Length == 0)
			{
				text = "CLD";
				ShortcutsFile.SetKeyboardShortcuts(cmdData.Application.Application.VersionName, "云线 批注", "ID_OBJECTS_CLOUD", text, "注释", "详图");
				Press.Keys(text, false);
			}
			else
			{
				Press.Keys(text, false);
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
